import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { getLocalStorage, LOCAL_STORAGE_KEY, NO_DESIGN_DOC_MODULE, USER_TYPE } from '@shared';

@Component({
  selector: 'app-case-page',
  templateUrl: './case-page.component.html',
  styleUrls: ['./case-page.component.scss'],
})
export class CasePageComponent implements OnInit {
  active;
  constructor(private router: Router) {}

  ngOnInit(): void {
    const urls = this.router.url.split('/');
    const isNoDesign = NO_DESIGN_DOC_MODULE.includes(urls[urls.length - 1]);
    const userType = getLocalStorage(LOCAL_STORAGE_KEY.LIVE_USER_TYPE) || USER_TYPE.DEVELOPER;
    this.active = userType === USER_TYPE.DESIGNER && !isNoDesign ? 'design' : 'demo';
  }
}
